GitHub上iOS关于HUD的第三方库实在太多了, 这三个比较常用:
ProgressHUD
用法简单,一行代码搞定:
#import "ProgressHUD.h" ProgressHUD.show("正在刷新!") ProgressHUD.showError("错误") ProgressHUD.showSuccess("刷新成功!") ProgressHUD.dismiss()
|
但是可自定义的属性不多;
SwiftNotice
用法同样简单,还支持顶部通知:
noticeTop("") notice("", type: NoticeType, autoClear: true) noticeOnlyText("") successNotice("") errorNotice("")
|
MBProgressHUD
[MBProgressHUD showHUDAddedTo:self.view animated:YES]; dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ dispatch_async(dispatch_get_main_queue(), ^{ [MBProgressHUD hideHUDForView:self.view animated:YES]; }); });
|
自定义:
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud.mode = MBProgressHUDModeAnnularDeterminate; hud.labelText = @"Loading"; [self doSomethingInBackgroundWithProgressCallback:^(float progress) { hud.progress = progress; } completionCallback:^{ [hud hide:YES]; }];
|